package state._new.state;

import state._new.GumballMachine;

public class NoQuarterState implements State {
    GumballMachine gumballMachine;

    public NoQuarterState(GumballMachine gumballMachine) {
        this.gumballMachine = gumballMachine;
    }

    @Override
    public void insertQuarter() {
        System.out.println("请勿重复付款");
    }

    @Override
    public void ejectQuarter() {
        System.out.println("未付款");
    }

    @Override
    public void tumCrank() {
        System.out.println("未付款");
    }

    @Override
    public void dispense() {
        gumballMachine.releaseBall();
        if (gumballMachine.getCount() > 0) {
            gumballMachine.setState(gumballMachine.getNoQuarterState());
        } else {
            System.out.println();
            gumballMachine.setState(gumballMachine.getSoldOutState());
        }
    }
}
